// ecg real wave area widget, derived from FlameGame, so will render wave
// every frame.
import 'dart:async';
import 'package:flame/game.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../controllers/ecg_controller.dart';

class EcgRealArea extends FlameGame {
  EcgRealArea() {
    pauseWhenBackgrounded = false;
  }

  @override
  Color backgroundColor() => const Color(0xff000000);

  @override
  bool get debugMode => false;

  @override
  FutureOr<void> onLoad() async {
    super.onLoad();
    var controller = Get.find<EcgController>();
    addAll(controller.ecgRealWaves.values);
  }

  @override
  void onGameResize(Vector2 size) {
    super.onGameResize(size);
    var controller = Get.find<EcgController>();
    controller.relayoutEcgRealWaves(size);
  }
}
